package cn.tedu._01mvcboot01.controller;

import cn.tedu._01mvcboot01.pojo.dto.UserRegDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    @RequestMapping("/v1/user/login")
    @ResponseBody
    public String login(String username, String password) {
        return "尊敬的" + username + "先生，欢迎光临！你的密码为：" + password;
    }

    @RequestMapping("/v1/user/reg")
    @ResponseBody
    public String reg(UserRegDTO userRegDTO) {
        String username = userRegDTO.getUsername();
        String password = userRegDTO.getPassword();
        Integer age = userRegDTO.getAge();
        return "尊敬的" + username + "先生，恭喜您注册成功！你的密码为：" + password + "，今年刚满" + age + "岁！";
    }
}
